package com.yoofn.kotlin.av.view.activity

import com.yanzhenjie.nohttp.rest.Response
import com.yoofn.kotlin.R
import com.yoofn.kotlin.base.BaseActivity
import com.yoofn.kotlin.base.BaseFragment
import com.yoofn.kotlin.base.Constants
import com.yoofn.kotlin.base.ViewConfig
import com.yoofn.kotlin.databinding.ActivityReplaceBinding

/**
 *
 * Created by kalshen on 17/6/22.
 * @描述 &{TODO}
 */
class ReplaceActivity : BaseActivity<ActivityReplaceBinding, String>() {
    override fun setupConfig(): ViewConfig<String> {
        return ViewConfig(R.layout.activity_replace)
    }

    override fun doInteractive() {
        val bundleExtra = intent.getBundleExtra(Constants.BUNDLE)

        val serializable = bundleExtra.getSerializable(Constants.Replace.FRAGMENT)
        val baseFragment = (serializable as Class<*>).newInstance() as BaseFragment<*, *>
        with(contentView) {
            supportFragmentManager.beginTransaction().replace(R.id.fl_replace_fragment, baseFragment).commit()
        }
    }

    override fun <ResponseType> doBusiness(what: Int, response: Response<ResponseType>) {

    }
}